Skip to content

Docs: add spatial shape constraints to SegResNetDS docstring#8797

Open
Talhax55z wants to merge 8 commits intoProject-MONAI:devfrom
Talhax55z:docs-segresnet-ds-shape-constraints
Open

Docs: add spatial shape constraints to SegResNetDS docstring#8797
Talhax55z wants to merge 8 commits intoProject-MONAI:devfrom
Talhax55z:docs-segresnet-ds-shape-constraints

Conversation

@Talhax55z
Copy link
Copy Markdown

Fixes #6771

Description

Adds spatial shape constraint documentation to the SegResNetDS class docstring.
Documents that input spatial dimensions must be divisible by 2 ** (len(blocks_down) - 1),
with a worked example and pointers to the existing shape_factor() and is_valid_shape() methods.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The SegResNetDS class docstring was extended to document spatial shape constraints. It states that in isotropic mode (resolution=None) each input spatial dimension must be divisible by 2 ** (len(blocks_down) - 1) (default blocks_down=(1,2,2,4) → divisible by 8). For anisotropic mode (resolution provided) it notes divisibility factors may vary per dimension and references shape_factor() and is_valid_shape() for exact factors and validation; an example showing shape_factor() output and valid/invalid shape checks was added. No runtime logic or public APIs were changed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed Title precisely describes the main change: adding spatial shape constraint documentation to SegResNetDS docstring.
Description check ✅ Passed Description covers key requirements: links issue #6771, explains the change, marks as non-breaking, and checks 'In-line docstrings updated'.
Linked Issues check ✅ Passed PR addresses issue #6771 by documenting spatial shape constraints with formulas, worked examples, and references to validation methods (shape_factor, is_valid_shape).
Out of Scope Changes check ✅ Passed All changes are scoped to SegResNetDS docstring updates; no unrelated code modifications present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@monai/networks/nets/segresnet_ds.py`:
- Around line 257-263: The docstring's fixed divisibility statement must be
conditioned on isotropic mode: update the "Spatial shape constraints" text in
segresnet_ds.py to state that the simple rule "divisible by 2 **
(len(blocks_down) - 1)" only applies when not using anisotropic/resolution-based
scaling (i.e., isotropic mode); when resolution is provided, note that
is_valid_shape() uses shape_factor() from anisotropic_scales and required
divisors are per-dimension (may differ across axes). Mention the resolution
parameter and anisotropic_scales, and point readers to use shape_factor() and
is_valid_shape() for the correct per-dimension divisors.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: aa4056de-e4e0-483e-bdcb-95f562b8f8f6

📥 Commits

Reviewing files that changed from the base of the PR and between a8176f1 and 28ab77c.

📒 Files selected for processing (1)
  • monai/networks/nets/segresnet_ds.py

I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: 28ab77c
I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: 584c915

Signed-off-by: Talhax55z <muhammadtalha223@gmail.com>
I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: 497ca39
I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: ee7c987
I, Talhax55z <muhammadtalha223@gmail.com>, hereby add my Signed-off-by to this commit: 9e1c8b9

Signed-off-by: Talhax55z <muhammadtalha223@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation of spatial shape constraints for the networks

1 participant